package com.songshuai.webapi.permission.controller;

import com.songshuai.webapi.baseapi.enumerations.ResultStatus;
import com.songshuai.webapi.baseapi.exception.BusinessException;
import com.songshuai.webapi.baseapi.pojo.QueryResponse;
import com.songshuai.webapi.permission.dto.response.CampusResDto;
import com.songshuai.webapi.permission.service.CampusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * @Author: hst
 * @Date: 2018/11/23 19:02
 * @Version 1.0
 */
@Api("角色管理")
@Slf4j
@RestController
@RequestMapping("/api/campus/")
public class CampusController extends BaseController{

   @Autowired
    private CampusService campusService;

    @ApiOperation(value = "查询当前登录用户所管理的校区")
    @GetMapping("queryManagedCampusList")
    public QueryResponse<List<CampusResDto>> queryManagedCampusList(){
        try{
            return campusService.queryCampusList();
        } catch (Exception ex) {
            log.error("api/campus/queryCampusList", ex);
            //throw new BusinessException(ex.getMessage(), ResultStatus.FAILOfficial);
        }
        return new QueryResponse(ResultStatus.ERROR_SEARCH_FAILED);
    }

}
